<template>
    <router-view :key="$route.fullPath" :routeName="route.name"/>
</template>

<script lang="ts">
import {defineComponent, ref} from 'vue'
import {RouteRecordRaw, useRoute, useRouter} from "vue-router"

export default defineComponent({
  name: 'terminal',
  async setup() {
    const router = useRouter()
    const route = useRoute()
    console.log("route name",route.name)
    const terminal = router.getRoutes().find(item => item.name == 'terminal')?.children as RouteRecordRaw[]
    if (route.name !== 'terminal-info' || !terminal.some(item => item.name == 'terminal-info')) {
      await router.replace({name: 'terminal-list'})
    }

    return {
      route,
    }
  }
})

</script>

<style scoped>

</style>
